package dem1;

import javax.swing.tree.TreeNode;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-05-18
 * Time: 8:53
 */
public class Test {
    public static void main1(String[] args) {

    }
    public TreeNode reverse(TreeNode root){
        if (root == null){
            return null;
        }
        TreeNode tmp = root.left;
        root.left = root.right;
        root.right = tmp;
        reverse(root.left);
        reverse(root.right);
        return root;
    }

    public boolean isReverse(TreeNode root){
        if (root == null)return true;
        return isSame(root.left, root.right);
    }
    public boolean isSame(TreeNode lefttree, TreeNode righttree){
        if (lefttree == null && righttree != null || lefttree != null && righttree == null){
            return false;
        }
        if (righttree == null && lefttree == null){
            return true;
        }
        if (lefttree.val != righttree.val){
            return false;
        }
        return isSame(lefttree.left, righttree.right) && isSame(lefttree.right,righttree.left);
    }

    @FunctionalInterface
    interface MoreParameterReturn {
        int test(int a,int b);
    }

    public static void main(String[] args) {
        MoreParameterReturn more = (a, b) -> 0;
    }
}
